package org.gdpu.model;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * 试卷信息
*/
@Entity
public class TestPaperInfo {

    /**
     *  系统主键
     */
    private int id;

    /**
     *  试卷编号
     *  说明：试卷编号一样代表同一份试卷里的题目，同时可根据生成时间产生一个批号
    */
    private String testPaperId;
    /**
        课程
     */
    private Subject subject;
    /**
     *  状态
     *  说明： true 可用 false 不可用
    */
    private Boolean state = true;

    /**
     *  试卷总分
    */
    private float sumScore;
    /**
     * 试卷名称
     */
    private String testPaperName;

    /**
     * 试卷创建者
     */
    private String owner;
    /**
     * 试卷描述
     */
    private String description;
    /**
     试卷题目
     */
    private Set<TestPaper> testPaper = new HashSet<TestPaper>(0);

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Boolean getState() {
        return state;
    }

    public void setState(Boolean state) {
        this.state = state;
    }

    public float getSumScore() {
        return sumScore;
    }

    public void setSumScore(float sumScore) {
        this.sumScore = sumScore;
    }

    public String getTestPaperId() {
        return testPaperId;
    }

    public void setTestPaperId(String testPaperId) {
        this.testPaperId = testPaperId;
    }

    public String getTestPaperName() {
        return testPaperName;
    }

    public void setTestPaperName(String testPaperName) {
        this.testPaperName = testPaperName;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToOne
    @JoinColumn(name = "subjectId")
    public Subject getSubject() {
        return subject;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "testPaperInfo")
    public Set<TestPaper> getTestPaper() {
        return testPaper;
    }

    public void setTestPaper(Set<TestPaper> persons) {
        this.testPaper = persons;
    }
}
